package com.randao.framework.model.domain.entity;

import com.randao.framework.common.model.response.ResultCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

/**
 * @Author： ~Mr·Weng~
 * @CreateTime： 2019年-04月-23日  3:32
 * Look at the wine in the glass toast the rich first.
 */
@Data
@ToString
@ApiModel(value = "Json格式的实体模型")
public class JsonResult implements ResultCode {

    @ApiModelProperty(value = "结果")
    private Object result = null;

    @ApiModelProperty(value = "状态码")
    private int code;

    @ApiModelProperty(value = "信息")
    private String message;

    @ApiModelProperty(value = "是否成功")
    private boolean success;

    public JsonResult(Object result, String message, boolean success, int code) {
        this.result = result;
        this.message = message;
        this.success = success;
        this.code = code;
    }

    public JsonResult() {
    }

    @Override
    public boolean success() {
        return success;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }
}
